﻿<%@ Page Title="Tìm kiếm sản phẩm" Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/OutSite.Master" CodeBehind="SearchProduct.aspx.vb" Inherits="Core.Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript">
    function CheckSubmit() {
        var data;
        //data = $('#ctl00_ContentPlaceHolder1_txtSearch').val();  //. DEV envi
        data = $('#ContentPlaceHolder1_txtSearch').val();  //. PRO envi
        if (data == "" || data == 'Nhập nội dung cần tìm') {
            $().toastmessage('showErrorToast', 'Bạn phải nhập nội dung cần tìm kiếm...');
            return false;
        } else {
            window.location = '/SearchProduct.aspx?s=' + data + '&p=1';
        }
    }
    function KeyCodePage(e) {
        if (e) { e = e } else { e = window.event }
        if (e.which) { var keycode = e.which } else { var keycode = e.keyCode }
        //alert(keycode);
        if (keycode == 13) { CheckSubmit(); }
    }
    function addCart(id, name, img, price) {
        $.ajax({
            url: "/ajaxSendCart.aspx?id=" + id + "&name=" + name + "&img=" + img + "&price=" + price,
            context: document.body,
            success: function (data) {
                $().toastmessage('showSuccessToast', "Đã thêm sản phẩm vào giỏ hàng!");
            }
        });
    }
</script>
<div class="boxPro">
	<div class="boxNew_header" style="padding-bottom:0px;float: left;width: 100%;"><span class="searchActive">Tìm kiếm sản phẩm</span><a href="/SearchNew.aspx" class="searchInActive">Tìm kiếm tin tức</a></div>
    <div class="searchTitle">
        <asp:TextBox ID="txtSearch" runat="server" CssClass="txtSearch" Text="Nhập nội dung cần tìm"></asp:TextBox>
        <input type="button" value="Tìm kiếm" onclick="return CheckSubmit();" class="btnInput submitType">
    </div>
    <asp:Repeater ID="RepeatItems" runat="server">
        <HeaderTemplate>
            <ul class="boxPro_ul">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
			        <div class="boxPro_img">
				        <a href="<%#buildLinkDetailPro(Eval("cateURI"), Eval("itemURI"), Eval("ProID"))%>" title="<%# Eval("ProName") %>"><img src='<%#buildImage(Eval("ProDate"), Eval("ProImage2"))%>' alt='<%# Eval("ProName") %>'></a>
			        </div>
			        <table class="boxProInfo">
				        <tr>
					        <td><a class="boxPro_title tdTitle" href='<%#buildLinkDetailPro(Eval("cateURI"), Eval("itemURI"), Eval("ProID"))%>' title='<%# Eval("ProName") %>'><%# Eval("ProName") %></a></td>
					        <td rowspan="2">
                                <input type="button" Class="iconAddCart" onclick="addCart(<%# Eval("ProID") %>, '<%#buildProductNameAJAX(Eval("ProName")) %>', '<%#buildImageAJAX(Eval("ProDate"), Eval("ProImage2"))%>', <%# Eval("ProNewPrice") %>);" />
                            </td>
				        </tr>
				        <tr>
					        <td class="boxPrice">Giá: <span class="boxProPrice"><%# formatVND(Eval("ProNewPrice"))%> VND</span></td>
				        </tr>
			        </table>
		        </li>
        </ItemTemplate>
        <FooterTemplate>
                </ul>         
        </FooterTemplate>
    </asp:Repeater>

	<div class="wrapNavigator" id="divNavigator" runat="server">
	</div>
</div>
</asp:Content>
